package cc.shacocloud.mirage.demo.kotlin.service

import cc.shacocloud.mirage.core.DeployVerticle
import cc.shacocloud.mirage.kotlin.Slf4j
import cc.shacocloud.mirage.kotlin.Slf4j.Companion.log
import io.vertx.kotlin.coroutines.CoroutineVerticle
import java.util.concurrent.atomic.AtomicInteger

/**
 * @author 思追(shaco)
 * @date 2023/3/19
 */
@Slf4j
@DeployVerticle(instances = 2)
class TestVerticle : CoroutineVerticle() {

    companion object {
        val i = AtomicInteger(0)
    }

    private var num: Int = -1

    override suspend fun start() {
        num = i.incrementAndGet()
        log.info("TestVerticle start $num")
    }

    override suspend fun stop() {
        log.info("TestVerticle stop $num")
    }
}